#ifndef OBJETO_ANIMADO_H
#define OBJETO_ANIMADO_H

#include <vector>

#include "CArea.h"
#include "CAnimation.h"
#include "CCamera.h"
#include "CFPS.h"
#include "CSurface.h"
#include <exception>
#include <iostream>
//==============================================================================
enum {
	ENTITY_TYPE_GENERIC = 0,
	ENTITY_TYPE_PLAYER,
	ENTITY_TYPE_ENEMY,
	ENTITY_TYPE_BOMBA,
	ENTITY_TYPE_EXPLOSION,
	ENTITY_TYPE_BALA,
	ENTITY_TYPE_PLANTA
};

//==============================================================================
enum {
	ENTITY_FLAG_NONE 	= 0,
	ENTITY_FLAG_GRAVITY	= 0x00000001,
	ENTITY_FLAG_GHOST	= 0x00000002,
	ENTITY_FLAG_MAPONLY	= 0x00000004
};

//=============================================================================
class CObjetoAnimado  {
    public:
		static std::vector<CObjetoAnimado*>    ObjectList;
    protected:
		CAnimation      Anim_Control;


		SDL_Surface*    Surf_Objeto[4];

	public:
		float	X;
		float	Y;
        int		Type;
		int		Width;
		int		Height;
		bool	Inactive;
		int		Flags;

	protected:
		int		Col_X;
		int		Col_Y;
		int		Col_Width;
		int		Col_Height;
		int     MaxFrames;
		int     CurrentIndex;

	public:
		CObjetoAnimado();

		virtual ~CObjetoAnimado();

	public:
		virtual bool OnLoad(char* File, int Width, int Height, int MaxFrames,int index);

		virtual void OnLoop();

		virtual void OnRender(SDL_Surface* Surf_Display);

		virtual void OnCleanup();

		virtual void OnAnimate();

		virtual bool OnCollision(CObjetoAnimado* Objeto);

	public:
		bool    Collides(int oX, int oY, int oW, int oH);

	protected:
		bool 	PosValid(int NewX, int NewY);

		bool 	PosValidTile(CTile* Tile);

		//bool 	PosValidEntity(CEntity* Entity, int NewX, int NewY);
		bool 	PosValidObject(CObjetoAnimado* Objeto, int NewX, int NewY, bool modoConsulta);
};
//==============================================================================
class CObjectCol {
    public:
        static std::vector<CObjectCol>	ObjectColList;

	public:
		CObjetoAnimado* ObjetoA;
		CObjetoAnimado* ObjetoB;

	public:
		CObjectCol();
};

//==============================================================================

#endif
